﻿@model List<TopicReply>
@{
    Layout = "";
}

@for (int i = 0; i < Model.Count; i++)
{
    var item = Model[i];
    <div class="reply" data-id="@item.Id" id="reply_@item.Id">
        <div class="info">
            <span class="name">
                <a href="#">@item.ReplyEmail</a>
            </span> ·
            <span class="time">
                <a class="reply-floor" href="#">#@(i + 1)</a> · <abbr class="timeago">@item.CreateOn.ToString("MM-dd HH:mm")</abbr>
            </span>
            <span class="opts pull-right">
                <a data-id="@item.Id" href="#" class="del">删除</a>
            </span>
        </div>
        <div class="markdown">
            <p>@item.ReplyContent</p>
        </div>
    </div>
}
<script>
    $(".markdown p").each(function () {
        var c = $(this).html();
        $(this).html(markdown.toHTML(c));
    });
    $(".del").on("click", function () {
        var id = $(this).data('id');
        $.ajax({
            url: "/Admin/TopicReplies/Delete",
            data: { id: id },
            success: function (data, status) {
                if (status == "nocontent")
                    $("#reply_" + id).hide();
            }
        });
    });
</script>
